home *** CD-ROM | disk | FTP | other *** search
- /* example using setpointer/clearpointer, getvalue/setvalue */
-
- /* */
- x = addlib("apig.library",0,-30,0)
-
- portname = "example16_port"
- p = openport(portname)
- call set_apig_globals()
- scrtitle = " This is Your New Screen !"
- wintitle = " This is your Window Title"
- winidcmp = CLOSEWINDOW
- winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO+ACTIVATE
-
- scr = openscreen(0,0,640,400,3,4,5,LACE+HIRES,CUSTOMSCREEN,scrtitle)
-
- /* open window */
- w1 = openwindow(portname,0,0,640,400,2,4,winidcmp,winflags,wintitle,scr,0,0,0)
-
- rpw1 = getwindowrastport(w1)
-
- call setrgb4(w1,0,6,6,6)
- call setrgb4(w1,1,2,5,15)
- call setrgb4(w1,2,4,12,9)
- call setrgb4(w1,3,9,4,9)
- call setrgb4(w1,7,0,5,1)
-
- x = setrast(rpw1,7)
- pdata = allocmem(148,'0001 0002'x)
-
- /* SPRITE DATA DEFINITION, this is NOT a 'SimpleSprite' structure */
-
- /* Note: pdata[0] & pdata[1] are position control, please refer to RKM */
- /* MEM_CLEAR made these zero */
-
- /* first line of sprite image */
- x = setarray(pdata,2,c2d('0000'x)) ; x = setarray(pdata,3,c2d('0000'x))
-
- /* second line of sprite image */
- x = setarray(pdata,4,c2d('1f80'x)) ; x = setarray(pdata,5,c2d('3f80'x))
-
- /* third line of sprite image */
- x = setarray(pdata,6,c2d('0cc0'x)) ; x = setarray(pdata,7,c2d('1cc0'x))
-
- /* etc. ... */
- x = setarray(pdata,8,c2d('0cc0'x)) ; x = setarray(pdata,9,c2d('1cc0'x))
- x = setarray(pdata,10,c2d('0f80'x)) ; x = setarray(pdata,11,c2d('1f80'x))
- x = setarray(pdata,12,c2d('0cc0'x)) ; x = setarray(pdata,13,c2d('1cc0'x))
- x = setarray(pdata,14,c2d('0cc0'x)) ; x = setarray(pdata,15,c2d('1cc0'x))
- x = setarray(pdata,16,c2d('1f80'x)) ; x = setarray(pdata,17,c2d('3f80'x))
- x = setarray(pdata,18,c2d('0000'x)) ; x = setarray(pdata,19,c2d('0000'x))
- x = setarray(pdata,20,c2d('1980'x)) ; x = setarray(pdata,21,c2d('3980'x))
- x = setarray(pdata,22,c2d('1980'x)) ; x = setarray(pdata,23,c2d('3980'x))
- x = setarray(pdata,24,c2d('1980'x)) ; x = setarray(pdata,25,c2d('3980'x))
- x = setarray(pdata,26,c2d('1980'x)) ; x = setarray(pdata,27,c2d('3980'x))
- x = setarray(pdata,28,c2d('1980'x)) ; x = setarray(pdata,29,c2d('3980'x))
- x = setarray(pdata,30,c2d('1980'x)) ; x = setarray(pdata,31,c2d('3980'x))
- x = setarray(pdata,32,c2d('0f80'x)) ; x = setarray(pdata,33,c2d('1f80'x))
- x = setarray(pdata,34,c2d('0000'x)) ; x = setarray(pdata,35,c2d('0000'x))
- x = setarray(pdata,36,c2d('0f00'x)) ; x = setarray(pdata,37,c2d('1f00'x))
- x = setarray(pdata,38,c2d('1980'x)) ; x = setarray(pdata,39,c2d('3980'x))
- x = setarray(pdata,40,c2d('1c00'x)) ; x = setarray(pdata,41,c2d('3c00'x))
- x = setarray(pdata,42,c2d('0e00'x)) ; x = setarray(pdata,43,c2d('1e00'x))
- x = setarray(pdata,44,c2d('0380'x)) ; x = setarray(pdata,45,c2d('0780'x))
- x = setarray(pdata,46,c2d('1980'x)) ; x = setarray(pdata,47,c2d('3b80'x))
- x = setarray(pdata,48,c2d('0f00'x)) ; x = setarray(pdata,49,c2d('1f00'x))
- x = setarray(pdata,50,c2d('0000'x)) ; x = setarray(pdata,51,c2d('0000'x))
- x = setarray(pdata,52,c2d('30c0'x)) ; x = setarray(pdata,53,c2d('70c0'x))
- x = setarray(pdata,54,c2d('30c0'x)) ; x = setarray(pdata,55,c2d('70c0'x))
- x = setarray(pdata,56,c2d('1980'x)) ; x = setarray(pdata,57,c2d('3980'x))
- x = setarray(pdata,58,c2d('0f00'x)) ; x = setarray(pdata,59,c2d('1f00'x))
- x = setarray(pdata,60,c2d('0600'x)) ; x = setarray(pdata,61,c2d('0e00'x))
- x = setarray(pdata,62,c2d('0600'x)) ; x = setarray(pdata,63,c2d('0e00'x))
- x = setarray(pdata,64,c2d('0f00'x)) ; x = setarray(pdata,65,c2d('1f00'x))
- x = setarray(pdata,66,c2d('0000'x)) ; x = setarray(pdata,67,c2d('0000'x))
- x = setarray(pdata,68,c2d('0000'x)) ; x = setarray(pdata,69,c2d('0000'x))
- /* height of this pointer is 34 */
-
- /* Note: pdata[70] & pdata[71] are for attached sprites */
- /* MEM_CLEAR made these zero */
-
-
- x = setpointer(w1,pdata,34,16,0,0)
-
- z = pitext(rpw1,100,100," You Should have a BUSY pointer ",5,2,JAM2,0)
- z = pitext(rpw1,100,140," You also have a new window title ",5,2,JAM2,0)
- z = pitext(rpw1,300,370," DONE ",6,2,JAM2,0)
-
-
- /** ---->>> changing window title <<<---- **/
- title = getvalue(w1,32,4,'S')
- say "Your Window title is" title
-
- mynewtitle = ALLOCMEM(length("MY NEW TITLE")+1,'0001 0000'x)
-
- call EXPORT(mynewtitle,"MY NEW TITLE")
-
- x = setvalue(w1,32,4,'P',mynewtitle,0)
- x = refreshwindowframe(w1)
- say "set value=" x
-
- title = getvalue(w1,32,4,'S')
- say "Your Window title is" title
-
-
-
- do forever /* IDCMP loop, wait for CLOSEWINDOW message */
- x = waitpkt(portname)
- do forever
- msg = '0000 0000'x
- msg = getpkt(portname)
- if msg = '0000 0000'x then leave
- class = getarg(msg,0)
- if class = CLOSEWINDOW then exitme = 1
- x = reply(msg,0)
- end
- if exitme = 1 then leave
-
- end
-
- getout:
-
- z = clearpointer(w1)
- z = freemem(pdata,148)
- z = freemem(mynewtitle,length("MY NEW TITLE")+1)
- z = closewindow(w1)
- z = closescreen(scr)
-
- exit
-
-